home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / door / ac174v13.zip / VCHAT.BAS < prev   
BASIC Source File  |  1992-10-01  |  10KB  |  319 lines

  1. ' $title: 'ANSIChat Vertical Split Screen Chat for RBBS-PC v17.4x'
  2. '
  3. '          (c) 1991,1992 By Richie Molinelli
  4. '
  5. '
  6. ' $INCLUDE: 'RBBS-VAR.BAS'
  7. '
  8. ' $SUBTITLE: 'ANSIChat - Vertical Split Screen SysOp ANSI Chat Routine'
  9. '
  10. ' $PAGE
  11. '
  12. '  SUBROUTINE NAME   -  ANSIChat
  13. '
  14. '            INPUT   -  None
  15. '
  16. '           OUTPUT   -  None
  17. '
  18. '  PURPOSE -- Allows Vertical Split Screen ANSI SysOp Chat for RBBS
  19. '
  20. '
  21. 1000 SUB ANSIChat STATIC               ' Main program
  22.      CALL ClearScrn
  23.      CALL Decorate
  24.      CALL SysopVChat
  25.      CALL ClearScrn
  26.      CALL SkipLine (1)
  27.      END SUB
  28. '
  29. 2000 SUB Decorate STATIC               ' Sets up the screen for chat
  30.      ScreenTxt$ = STRING$(78,177)
  31.      AC1$ = ""               ' Blue
  32.      AC2$ = ""               ' Red
  33.      CALL CurLocate (1,1)
  34.      CALL QuickTPut (AC1$ + ScreenTxt$,0)
  35.      CALL CurLocate (24,1)
  36.      CALL QuickTput (ScreenTxt$,0)
  37.      CALL CurLocate (1,1)
  38.      CALL QuickTPut (ZEmphasizeOn$ + "ANSIChat v1.3",0)
  39.      OutTxt$ =  " >>> " +  ZRBBSName$ + " <<< "
  40.      LocalColumn = 40 - (LEN(OutTxt$)/2)
  41.      CALL CurLocate (1,LocalColumn)
  42.      CALL QuickTPut (OutTxt$,0)
  43.      CALL CurLocate (1,60)
  44.      CALL QuickTPut ("(c) 1992 R Molinelli",0)
  45.      Column = 40
  46.      CALL QuickTPut (AC2$,0)
  47.      FOR Row = 2 TO 23
  48.         CALL CurLocate (Row,Column) : _
  49.         CALL QuickTPut(STRING$(1,186),0) : _
  50.      NEXT Row
  51.      OutTxt$ = ZSysopFirstName$ + " " + ZSysopLastName$
  52.      LocalColumn = (40 - LEN(OutTxt$))/2
  53.      CALL CurLocate (24,LocalColumn)
  54.      CALL QuickTPut (ZEmphasizeOn$ + OutTxt$,0)
  55.      LocalColumn = 40 + ((40 - LEN(ZActiveUserName$))/2)
  56.      CALL CurLocate (24,LocalColumn)
  57.      CALL QuickTPut (ZActiveUserName$ + ZEmphasizeOff$,0)
  58.      CALL Line25
  59.      CALL CurLocate (2,1)
  60.      END SUB
  61. '
  62. 3000 SUB RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,Bs) STATIC  ' Writes Remote Users Input
  63.      IF HoldRTxt$ <> "" AND Bs = 1 THEN _
  64.         HoldRTxt$ = MID$(HoldRTxt$,1,LEN(HoldRTxt$) - 1)
  65.      IF Bs = 1 THEN _
  66.         RemoteColumn = RemoteColumn - 1 : _
  67.         RemoteTxt$ = " " : _
  68.         GOSUB 3010 : _
  69.         Bs = 0 : _
  70.         GOTO 3020
  71.      IF LEN(HoldRTxt$) => 38 THEN
  72.         HoldRTxt$ = ""
  73.         RemoteColumn = 42
  74.         RemoteRow = RemoteRow + 1
  75.         IF RemoteRow > 23 THEN _
  76.            CALL ClearRemoteUpper : _
  77.            RemoteRow = 2
  78.         CALL CurLocate (RemoteRow,RemoteColumn)
  79.      END IF
  80.      IF RemoteTxt$ <> " " THEN _
  81.         HoldRTxt$ = HoldRTxt$ + RemoteTxt$ _
  82.      ELSE _
  83.         HoldRTxt$ = ""
  84.      IF RemoteColumn > 78 AND RemoteTxt$ = " " THEN
  85.         RemoteColumn = 42
  86.         RemoteRow = RemoteRow + 1
  87.         IF RemoteRow = 12 THEN _
  88.            CALL ClearRemoteLower
  89.         IF RemoteRow > 23 THEN _
  90.            CALL ClearRemoteUpper : _
  91.            RemoteRow = 2
  92.         CALL CurLocate (RemoteRow,RemoteColumn)
  93.         RemoteTxt$ = ""
  94.         HoldRTxt$ = ""
  95.         EXIT SUB
  96.      END IF
  97.      IF RemoteColumn > 79 AND RemoteTxt$ <> " " THEN
  98.         RemoteColumn = 80 - LEN(HoldRTxt$)
  99.         HoldCTxt$ = STRING$((LEN(HoldRTxt$) + 1),32)
  100.         CALL CurLocate (RemoteRow,RemoteColumn)
  101.         CALL QuickTPut (HoldCTxt$,0)
  102.         RemoteColumn = 42
  103.         RemoteRow = RemoteRow + 1
  104.         IF RemoteRow = 12 THEN _
  105.            CALL ClearRemoteLower
  106.         IF RemoteRow > 23 THEN _
  107.            CALL ClearRemoteUpper : _
  108.            RemoteRow = 2
  109.         CALL CurLocate (RemoteRow,RemoteColumn)
  110.         CALL QuickTPut (ZFG2$ + HoldRTxt$,0)
  111.         RemoteColumn = RemoteColumn + LEN(HoldRTxt$)
  112.         CALL CurLocate (RemoteRow,RemoteColumn)
  113.         ZRemoteTxt$ = ""
  114.         EXIT SUB
  115.      END IF
  116. 3010 CALL CurLocate (RemoteRow,RemoteColumn)
  117.      CALL QuickTPut (ZFG2$ + RemoteTxt$,0)
  118.      IF Bs > 0 THEN _
  119.         CALL CurLocate (RemoteRow,RemoteColumn) : _
  120.         RETURN
  121.      RemoteColumn = RemoteColumn + LEN(RemoteTxt$)
  122. 3020 RemoteTxt$ = ""
  123.      END SUB
  124. '
  125. 4000 SUB LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,Bs) STATIC      ' Writes Local Users Input
  126.      IF HoldLTxt$ <> "" AND Bs = 1 THEN _
  127.         HoldLTxt$ = MID$(HoldLTxt$,1,LEN(HoldLTxt$) - 1)
  128.      IF Bs = 1 THEN _
  129.         LocalColumn = LocalColumn - 1 : _
  130.         LocalTxt$ = " " : _
  131.         GOSUB 4010 : _
  132.         Bs = 0 : _
  133.         GOTO 4020
  134.      IF LEN(HoldLTxt$) => 38 THEN
  135.         HoldLTxt$ = ""
  136.         LocalColumn = 1
  137.         LocalRow = LocalRow + 1
  138.         IF LocalRow > 23 THEN _
  139.            CALL ClearLocalUpper : _
  140.            LocalRow = 2
  141.         CALL CurLocate (LocalRow,LocalColumn)
  142.      END IF
  143.      IF LocalTxt$ <> " " THEN _
  144.         HoldLTxt$ = HoldLTxt$ + LocalTxt$ _
  145.      ELSE _
  146.         HoldLTxt$ = ""
  147.      IF LocalColumn > 37 AND LocalTxt$ = " " THEN
  148.         LocalColumn = 1
  149.         LocalRow = LocalRow + 1
  150.         IF LocalRow = 12 THEN _
  151.            CALL ClearLocalLower
  152.         IF LocalRow > 23 THEN _
  153.            CALL ClearLocalUpper : _
  154.            LocalRow = 2
  155.         CALL CurLocate (LocalRow,LocalColumn)
  156.         LocalTxt$ = ""
  157.         HoldLTxt$ = ""
  158.         EXIT SUB
  159.      END IF
  160.      IF LocalColumn > 38 AND LocalTxt$ <> " " THEN
  161.         LocalColumn = 39 - LEN(HoldLTxt$)
  162.         HoldCTxt$ = STRING$((LEN(HoldLTxt$) + 1),32)
  163.         CALL CurLocate (LocalRow,LocalColumn)
  164.         CALL QuickTPut (HoldCTxt$,0)
  165.         LocalColumn = 1
  166.         LocalRow = LocalRow + 1
  167.         IF LocalRow = 12 THEN _
  168.            CALL ClearLocalLower
  169.         IF LocalRow > 23 THEN
  170.            CALL ClearLocalUpper
  171.            LocalRow = 2
  172.         END IF
  173.         CALL CurLocate (LocalRow,LocalColumn)
  174.         CALL QuickTPut (ZFG4$ + HoldLTxt$,0)
  175.         LocalColumn = LocalColumn + LEN(HoldLTxt$)
  176.         CALL CurLocate (LocalRow,LocalColumn)
  177.         LocalTxt$ = ""
  178.         EXIT SUB
  179.      END IF
  180. 4010 CALL CurLocate (LocalRow,LocalColumn)
  181.      CALL QuickTPut (ZFG4$ + LocalTxt$,0)
  182.      IF Bs > 0 THEN _
  183.         CALL CurLocate (LocalRow,LocalColumn) : _
  184.         RETURN
  185.      LocalColumn = LocalColumn + LEN(LocalTxt$)
  186. 4020 LocalTxt$ = ""
  187.      END SUB
  188. '
  189.      SUB SysopVChat STATIC               ' Verticl SysOp ANSI Chat routine
  190. 5000 LocalColumn = 1
  191.      LocalRow = 2
  192.      RemoteColumn = 42
  193.      RemoteRow = 2
  194.      RemoteTxt$ = "Hi, " + ZFirstName$ + ".  Go Ahead..."
  195.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  196.      RemoteColumn = 42
  197.      RemoteRow = 3
  198.      HoldLTxt$ = ""
  199.      HoldRTxt$ = ""
  200.      HoldCTxt$ = ""
  201.      CALL CurLocate (LocalRow,LocalColumn)
  202.      ZWaitExpired = ZFalse
  203. 5010 ZAutoLogoff! = TIMER + ZWaitBeforeDisconnect
  204.      CALL Carrier
  205.      IF ZSubParm < 0 THEN _
  206.         EXIT SUB
  207. 5020 CALL FindFKey
  208.      IF ZWasCM = 0 THEN _
  209.         CALL FlushCom (ZCommPortStack$) : _
  210.         ZKeyPressed$ = "" : _
  211.         ZWasCM = ZTrue : _
  212.         GOTO 5010
  213.      LocalTxt$ = ZKeyPressed$
  214.      IF ZKeyPressed$ = ZEscape$ THEN _
  215.         EXIT SUB
  216.      IF LocalTxt$ = "" THEN _
  217.         GOTO 5030
  218.      IF LocalTxt$ = CHR$(8) THEN _
  219.         GOTO 5070 _
  220.      ELSE IF LocalTxt$ = CHR$(9) THEN _
  221.         GOTO 5090 _
  222.      ELSE IF LocalTxt$ = CHR$(13) THEN _
  223.         GOTO 6010
  224.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  225.      GOTO 5010
  226. 5030 IF ZLocalUser THEN _
  227.         GOTO 5010
  228.      IF ZCommPortStack$ <> "" THEN _
  229.         RemoteTxt$ = LEFT$(ZCommPortStack$,LEN(ZCommPortStack$) - 1) : _
  230.         CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  231.      CALL EofComm (Char)
  232.      IF Char <> -1 THEN _
  233.         GOTO 5050 _
  234.      ELSE _
  235.         GOTO 5010
  236. 5050 ZAutoLogoff! = TIMER + ZWaitBeforeDisconnect
  237.      CALL GetCom (RemoteTxt$)
  238.      IF RemoteTxt$ = CHR$(8) THEN _
  239.         GOTO 6030 _
  240.      ELSE IF RemoteTxt$ = CHR$(9) THEN _
  241.         GOTO 6050 _
  242.      ELSE IF RemoteTxt$ = CHR$(13) THEN _
  243.         GOTO 6070
  244.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  245.      GOTO 5010
  246. 5070 IF LocalColumn - 1 > 0 THEN _     ' Local Back Space
  247.         CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,1)
  248.      GOTO 5010
  249. 5090 IF LocalColumn + 5 > 38 AND LocalRow < 24 THEN _ 'Local TAB
  250.         LocalColumn = 38 _
  251.      ELSE _
  252.         LocalColumn = LocalColumn + 4
  253.      LocalTxt$ = " "
  254.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  255.      GOTO 5010
  256. 6010 LocalColumn = 38                  ' Local Carriage Return
  257.      LocalTxt$ = " "
  258.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  259.      GOTO 5010
  260. 6030 IF RemoteColumn - 1 > 41 THEN _   ' Remote Back Space
  261.         CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,1)
  262.      GOTO 5010
  263. 6050 IF RemoteColumn + 5 > 79 AND RemoteRow < 24 THEN _  ' Remote TAB
  264.         RemoteColumn = 79 _
  265.      ELSE _
  266.         RemoteColumn = RemoteColumn + 4
  267.      RemoteTxt$ = " "
  268.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  269.      GOTO 5010
  270. 6070 RemoteColumn = 79                 ' Remote Carriage Return
  271.      RemoteTxt$ = " "
  272.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  273.      GOTO 5010
  274.      END SUB
  275. '
  276. 7000 SUB ClearScrn STATIC              ' Clears the Entire screen
  277.      CALL QuickTPut ("",0)
  278.      ZSubParm = 2
  279.      CALL Line25
  280.      ZSubParm = 0
  281.      CALL CurLocate (1,1)
  282.      END SUB
  283. '
  284. 7100 SUB ClearRemoteUpper STATIC       ' Clears the Upper half of Remote users screen
  285.      Column = 42
  286.      FOR Row = 2 TO 13
  287.          CALL CurLocate (Row,Column)
  288.          CALL QuickTPut ("",0)
  289.      NEXT Row
  290.      END SUB
  291. '
  292. 7200 SUB ClearLocalUpper STATIC        ' Clears the Upper half of Local users screen
  293.      Column = 1
  294.      FOR Row = 2 TO 13
  295.         CALL CurLocate (Row,Column)
  296.         CALL QuickTPut (STRING$(38,32),0)
  297.      NEXT Row
  298.      END SUB
  299. '
  300. 7300 SUB ClearRemoteLower STATIC       ' Clears the lower half of Remote users Screen
  301.      Column = 42
  302.      FOR Row = 14 TO 23
  303.         CALL CurLocate (Row,Column)
  304.         CALL QuickTPut ("",0)
  305.      NEXT Row
  306.      END SUB
  307. '
  308. 7400 SUB ClearLocalLower STATIC         ' Clears the lower half of Local users screen
  309.      Column = 1
  310.      FOR Row = 14 TO 23
  311.         CALL CurLocate (Row,Column)
  312.         CALL QuickTPut (STRING$(38,32),0)
  313.      NEXT Row
  314.      END SUB
  315. '
  316. 7500 SUB CurLocate (Row,Column) STATIC   ' Moves the cursor to desired position
  317.      CALL QuickTPut ("" + MID$(STR$(Row),2) + ";" + MID$(STR$(Column),2) + "H",0)
  318.      END SUB
  319.